//
//  StarView.m
//  MyTrip
//
//  Created by zhang on 15/8/29.
//  Copyright (c) 2015年 张益. All rights reserved.
//

#import "StarView.h"
#import "DKNightVersion.h"

@interface StarView ()


@property (nonatomic, assign) NSInteger count;
@end

@implementation StarView

- (instancetype) initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [DKNightVersionManager addClassToSet:self.class];
        self.nightBackgroundColor = UIColorFromRGB(0x343434);
    }
    return self;
}


- (void)createViewWithStarNum:(NSInteger)starNum{
    [DKNightVersionManager addClassToSet:self.class];
    self.nightBackgroundColor = UIColorFromRGB(0x343434);
    self.count = 0;
    for (NSInteger i = 0; i < starNum; i++) {
    
        UIImageView *starImage1 = [[[UIImageView alloc] initWithFrame:CGRectMake(i * 15 + 2, 0, 15, 15)] autorelease];
        [starImage1 setImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"yellowStar" ofType:@"png"]]];
        [self addSubview:starImage1];
        _count++;
    }
    for (NSInteger i = starNum; i < 5; i++) {
        UIImageView *starImage = [[[UIImageView alloc] initWithFrame:CGRectMake(i * 15 + 2, 0, 15, 15)] autorelease];
        [starImage setImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"blackStar" ofType:@"png"]]];
        [self addSubview:starImage];
//        starImage.alpha = 0.5;
        _count++;
    }
//    NSLog(@"%ld", _count);
}





@end
